home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1986 July & August / rerun-1986-07-08.d64 / mag reader (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  149 lines

  1. 0 goto 100
  2. 1 rem mag reader v6.4
  3. 2 rem (c) 1986 david a. hook
  4. 9 rem display a screen
  5. 10 print "[147][146]";: open 2, 8, 2, f$
  6. 11 for i = fl to ll
  7. 12 print# 15, "p" + chr$(2) + chr$(i and 255) + chr$(i/256) + chr$(1)
  8. 13 sys ad
  9. 14 l=peek(142)
  10. 15 print left$(a$,l);
  11. 16 ifl<40 then print chr$(13);
  12. 17 poke 212, 0: next: close 2: return
  13. 100 if lk goto 600: rem after picture loads
  14. 110 poke 55, 0: poke 56, 32: clr
  15. 120 a$="abcdefghijklmnopqrst": a$=a$+a$
  16. 140 rem bkgd, char colors
  17. 150 read bb, ch
  18. 160 poke 53280, bb: poke 53281, bb: poke 646, ch
  19. 180 rem pic name, type, border color
  20. 190 read pf$, t$, kf
  21. 200 poke 2, 2 + 2*(t$="k") + (t$="d")
  22. 220 rem issue file name
  23. 230 read f$
  24. 250 rem mag title, issue month
  25. 260 read mt$, mo$
  26. 280 cd$=""
  27. 290 sp$="                                      "
  28. 310 gosub 1000: rem help
  29. 330 lp=25: ad=896: ml=49152: if peek(ad)-160 then gosub 8000: rem read data
  30. 350 open 15, 8, 15, "i0"
  31. 370 rem get total line count
  32. 380 open 2, 8, 2, f$
  33. 390 sys ad
  34. 400 ln=val(a$)-1: pg=ln/lp
  35. 410 close 2
  36. 420 if ln<1 or pg<>int(pg) then print: print " file error": close 15: stop
  37. 440 rem skip the load if no hi-res picture included
  38. 450 lk=1: if peek(2)>1 then lk=2: goto 600
  39. 470 rem add special characters to picture file name
  40. 480 if t$="k" then pf$=chr$(129)+left$(pf$+"        ",14)
  41. 490 if t$="d" then pf$="dd"+pf$
  42. 510 load pf$, 8, 1
  43. 530 end: rem never gets here
  44. 599 rem display picture
  45. 600 gosub 2000
  46. 799 rem main loop
  47. 800 gosub 5000: rem screen prompt
  48. 810 gosub 3000: rem get fn key
  49. 820 goto 800
  50. 999 rem help screen
  51. 1000 print "[147]"; tab(14); "[200]elp [211]creen"
  52. 1010 print tab(14); "[163][163][163][163][163][163][163][163][163][163][163]"
  53. 1020 print "   [217]ou may return here by pressing f2[146]."
  54. 1030 print " f1[146] -- [212]able of [195]ontents"
  55. 1040 print " f2[146] -- [212]his [200][197][204][208] [211]creen"
  56. 1050 print " f3[146] -- [199]o to a [211]creen (by its number)"
  57. 1060 print " f5[146] -- [208]revious [211]creen"
  58. 1070 print " f7[146] -- [206]ext [211]creen"
  59. 1080 print " f8[146] -- [209]uit [205]agazine"
  60. 1090 print "   [212]hese programs were developed by:"
  61. 1100 print tab(13); "[196]avid [193]. [200]ook"
  62. 1110 print "    for the [194][193][210][210][201][197] [213][211][197][210] [199][210][207][213][208] ([194][213][199])"
  63. 1120 print "   [197]ntire contents of this magazine are"
  64. 1130 print " (c) 1986 by the [193]uthors within."
  65. 1140 if lk then sc=0: goto 5000
  66. 1150 print "   [211]trike [211][208][193][195][197] to exit the cover page."
  67. 1160 if peek(2)<>2 then m$="([201]t's now loading...)": gosub 5200: print
  68. 1170 m$="[208]lease [211]tand [194]y..."
  69. 1180 goto 5100
  70. 1999 rem display picture
  71. 2000 if lk=2 goto 2040
  72. 2010 poke 53280, kf: sys ml
  73. 2030 rem wait for a key press
  74. 2040 poke 198, 0: wait 198, 1
  75. 2050 poke 53265, peek(53265) and 223
  76. 2060 poke 53270, peek(53270) and 239
  77. 2070 poke 53272, (peek(53272) and 240) or 4
  78. 2080 poke 53280, bb: poke 53281, bb: poke 646, ch
  79. 2100 rem monthly issue screen
  80. 2110 print "[147][146]";
  81. 2120 m$=mt$: gosub 5200
  82. 2130 print: print: m$=mo$: gosub 5200
  83. 2140 sc=0
  84. 2160 return
  85. 2999 rem get a function key
  86. 3000 cp=sc
  87. 3010 get k$: if k$<"[133]" or k$>"[140]" goto 3010
  88. 3020 on asc(k$)-132 gosub 3100, 3300, 3500, 3700, 3200, 3030, 3030, 3800
  89. 3030 return
  90. 3100 sc=1: gosub 4000: goto 10
  91. 3200 goto 1000
  92. 3300 m$="[211][195][210][197][197][206] " + str$(cp)+ "  [197]nter [208]age # ?[157]": gosub 5100
  93. 3310 gosub 6000: if sc=0 goto 2000
  94. 3320 gosub 4000: goto 10
  95. 3500 sc=cp-1: gosub 4000: if sc=0 goto 2000
  96. 3510 goto 10
  97. 3700 sc=cp+1: gosub 4000: goto 10
  98. 3800 close 15: poke55, 0: poke 56, 160: clr: end
  99. 3999 rem set page parameters
  100. 4000 if sc>pg then sc=pg
  101. 4010 if sc<1 then sc=0: goto 4030
  102. 4020 fl=(sc-1)*lp + 2: ll=sc*lp + 1
  103. 4030 return
  104. 4999 rem normal screen prompt
  105. 5000 sc$=str$(sc)
  106. 5010 m$="[208]ress 'f2' for [200][197][204][208] -- [211][195][210][197][197][206] " + sc$
  107. 5099 rem message on last screen line
  108. 5100 print cd$; ""; sp$; cd$;
  109. 5199 rem center a message
  110. 5200 print spc((40-len(m$))/2); m$;
  111. 5210 return
  112. 5999 rem input up to 4 digits
  113. 6000 sc$="": k=0
  114. 6010 get k$: if k$="" goto 6010
  115. 6020 if k$=chr$(13) and k>0 then print k$: goto 6080
  116. 6030 if k$=chr$(20) and k>0 then k=k-1: sc$=left$(sc$,k): print k$;
  117. 6040 if k=4 then print: goto 6080
  118. 6050 if k$<"0" or k$>"9" goto 6010
  119. 6060 sc$=sc$+k$: k=k+1: print k$;
  120. 6070 goto 6010
  121. 6080 sc=val(sc$): return
  122. 6999 rem bkgd, char colors
  123. 7000 data  1, 14
  124. 7099 rem pic name, type, border color
  125. 7100 data "pic a", "k", 1
  126. 7199 rem issue file name
  127. 7200 data "jul86"
  128. 7299 rem mag title, issue month
  129. 7300 data "[212]he [194][213][199] [206]ewsletter", "[202]uly 1986"
  130. 7999 rem read & store ml
  131. 8000 ck=0: for i=ad to ad+41: read da: poke i,da: ck=ck+da: next
  132. 8010 if ck<>6121 then print "error in data": stop
  133. 8030 ck=0: for i=ml to ml+127: read da: poke i,da: ck=ck+da: next
  134. 8040 if ck<>17262 then print "error in data": stop
  135. 8060 return
  136. 8080 rem c64 string thing data (file 2)
  137. 8090 data 160,2,177,45,153,137,0,200,192,6,208,246,162,2
  138. 8100 data 32,198,255,32,228,255,201,13,240,15,164,142,145,140
  139. 8110 data 200,132,142,196,139,240,4,165,144,240,234,76,204,255
  140. 8130 rem ml data for mag display
  141. 8140 data 173,17,208,41,239,141,17,208,164,2,208,43,169,40,133,251
  142. 8150 data 162,131,134,252,162,4,169,216,160,0,32,109,192,173,22,208
  143. 8160 data 41,191,9,16,141,22,208,173,16,135,141,33,208,169,64,133
  144. 8170 data 251,162,127,134,252,208,8,169,0,133,251,162,92,134,252,169
  145. 8180 data 4,170,160,0,32,109,192,132,251,162,96,134,252,162,32,169
  146. 8190 data 32,32,109,192,173,17,208,9,34,141,17,208,173,24,208,9
  147. 8200 data 8,141,24,208,173,17,208,9,16,141,17,208,96,132,253,133
  148. 8210 data 254,177,251,145,253,200,208,249,230,252,230,254,202,208,242,96
  149.